/*
 * Main.fx
 *
 * Created on 21-apr-2011, 15.44.22
 */

package jfx_mobile_test_01;

/**
 * @author Mitch
 */
public class Login {

    public-read var sfondo: javafx.scene.shape.Rectangle;//GEN-BEGIN:main
    public-read var lbl_user: javafx.scene.control.Label;
    public-read var txt_user: javafx.scene.control.TextBox;
    public-read var lbl_passwd: javafx.scene.control.Label;
    public-read var txt_passwd: javafx.scene.control.TextBox;
    public-read var form_panel: javafx.scene.layout.Panel;
    public-read var imgv_logo: javafx.scene.image.ImageView;
    public-read var separator: javafx.scene.shape.Line;
    public-read var btn_login: javafx.scene.control.Button;
    public-read var btn_fullscreen: javafx.scene.control.Button;
    public-read var Panel_Login: javafx.scene.layout.Panel;
    public-read var button2: javafx.scene.control.Button;
    public-read var button3: javafx.scene.control.Button;
    public-read var button4: javafx.scene.control.Button;
    public-read var button5: javafx.scene.control.Button;
    public-read var button6: javafx.scene.control.Button;
    public-read var button7: javafx.scene.control.Button;
    public-read var button8: javafx.scene.control.Button;
    public-read var vbox: javafx.scene.layout.VBox;
    public-read var Panel_Menu: javafx.scene.layout.Panel;
    public-read var scene: javafx.scene.Scene;
    public-read var linearGradient: javafx.scene.paint.LinearGradient;
    public-read var LOGO: javafx.scene.image.Image;
    
    public-read var currentState: org.netbeans.javafx.design.DesignState;
    
    // <editor-fold defaultstate="collapsed" desc="Generated Init Block">
    init {
        lbl_user = javafx.scene.control.Label {
            layoutX: 24.0
            layoutY: 40.0
            text: "Utente:"
        };
        txt_user = javafx.scene.control.TextBox {
            layoutX: 69.0
            layoutY: 38.0
        };
        lbl_passwd = javafx.scene.control.Label {
            layoutX: 4.0
            layoutY: 68.0
            text: "Password:"
        };
        txt_passwd = javafx.scene.control.TextBox {
            layoutX: 69.0
            layoutY: 66.0
        };
        form_panel = javafx.scene.layout.Panel {
            layoutX: 16.0
            layoutY: 89.0
            width: 208.0
            height: 148.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind form_panel.width
                height: bind form_panel.height
            }
            content: [ lbl_user, txt_user, lbl_passwd, txt_passwd, ]
        };
        separator = javafx.scene.shape.Line {
            opacity: 0.36
            layoutX: 20.0
            layoutY: 84.0
            strokeWidth: 1.0
            endX: 200.0
            endY: 0.0
        };
        btn_login = javafx.scene.control.Button {
            opacity: 1.0
            layoutX: 40.0
            layoutY: 202.0
            width: 145.0
            height: 39.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind btn_login.width
                height: bind btn_login.height
            }
            text: "Accedi"
            textWrap: false
            action: execLogin
            strong: false
        };
        btn_fullscreen = javafx.scene.control.Button {
            layoutX: 116.0
            layoutY: 269.0
            text: "Fullscreen"
        };
        button2 = javafx.scene.control.Button {
            visible: true
            width: 180.0
            height: 24.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind button2.width
                height: bind button2.height
            }
            text: "Button"
        };
        button3 = javafx.scene.control.Button {
            visible: true
            width: 180.0
            height: 24.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind button3.width
                height: bind button3.height
            }
            text: "Button"
        };
        button4 = javafx.scene.control.Button {
            visible: true
            width: 180.0
            height: 24.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind button4.width
                height: bind button4.height
            }
            text: "Button"
        };
        button5 = javafx.scene.control.Button {
            visible: true
            width: 180.0
            height: 24.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind button5.width
                height: bind button5.height
            }
            text: "Button"
        };
        button6 = javafx.scene.control.Button {
            visible: true
            width: 180.0
            height: 24.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind button6.width
                height: bind button6.height
            }
            text: "Button"
        };
        button7 = javafx.scene.control.Button {
            visible: true
            width: 180.0
            height: 24.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind button7.width
                height: bind button7.height
            }
            text: "Button"
        };
        button8 = javafx.scene.control.Button {
            visible: true
            width: 180.0
            height: 24.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind button8.width
                height: bind button8.height
            }
            text: "Button"
        };
        vbox = javafx.scene.layout.VBox {
            visible: true
            layoutX: 30.0
            layoutY: 20.0
            width: 180.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind vbox.width
                height: bind vbox.height
            }
            content: [ button2, button3, button4, button5, button6, button7, button8, ]
            hpos: javafx.geometry.HPos.CENTER
            nodeHPos: javafx.geometry.HPos.CENTER
            spacing: 6.0
        };
        Panel_Menu = javafx.scene.layout.Panel {
            visible: true
            layoutX: 250.0
            layoutY: 0.0
            width: 240.0
            height: 320.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind Panel_Menu.width
                height: bind Panel_Menu.height
            }
            content: [ vbox, ]
        };
        linearGradient = javafx.scene.paint.LinearGradient {
            cycleMethod: javafx.scene.paint.CycleMethod.REPEAT
            proportional: true
            stops: [ javafx.scene.paint.Stop { offset: 0.0, color: javafx.scene.paint.Color.web ("#FFFFFF") }, javafx.scene.paint.Stop { offset: 1.0, color: javafx.scene.paint.Color.web ("#000000") }, ]
        };
        sfondo = javafx.scene.shape.Rectangle {
            visible: true
            opacity: 0.6
            layoutX: -30.0
            layoutY: 30.0
            rotate: 90.0
            fill: linearGradient
            width: 320.0
            height: 240.0
            arcWidth: 0.0
            arcHeight: 0.0
        };
        LOGO = javafx.scene.image.Image {
            url: "{__DIR__}gamma_meccanica.jpg"
            backgroundLoading: false
            smooth: false
            width: 200.0
            height: 50.0
            placeholder: null
            preserveRatio: true
        };
        imgv_logo = javafx.scene.image.ImageView {
            visible: true
            opacity: 1.0
            id: "node_logo"
            layoutX: 16.0
            layoutY: 28.0
            focusTraversable: false
            image: LOGO
        };
        Panel_Login = javafx.scene.layout.Panel {
            visible: true
            layoutX: 0.0
            layoutY: 0.0
            width: 240.0
            height: 320.0
            layoutInfo: javafx.scene.layout.LayoutInfo {
                width: bind Panel_Login.width
                height: bind Panel_Login.height
            }
            content: [ form_panel, imgv_logo, separator, btn_login, btn_fullscreen, ]
        };
        scene = javafx.scene.Scene {
            width: 240.0
            height: 300.0
            content: javafx.scene.layout.Panel {
                content: getDesignRootNodes ()
            }
        };
        
        currentState = org.netbeans.javafx.design.DesignState {
            names: [ "Login", "Menu", ]
            stateChangeType: org.netbeans.javafx.design.DesignStateChangeType.PAUSE_AND_PLAY_FROM_START
            actual: 0
            createTimeline: function (actual) {
                if (actual == 0) {
                    javafx.animation.Timeline {
                        keyFrames: [
                            javafx.animation.KeyFrame {
                                time: 800ms
                                values: [
                                    Panel_Login.layoutX => 0.0 tween javafx.animation.Interpolator.DISCRETE,
                                    Panel_Menu.layoutX => 250.0 tween javafx.animation.Interpolator.DISCRETE,
                                ]
                                action: function() {
                                    Panel_Login.visible = true;
                                    vbox.nodeHPos = javafx.geometry.HPos.CENTER;
                                    Panel_Menu.visible = true;
                                }
                            }
                        ]
                    }
                } else if (actual == 1) {
                    javafx.animation.Timeline {
                        keyFrames: [
                            javafx.animation.KeyFrame {
                                time: 800ms
                                values: [
                                    Panel_Login.layoutX => -250.0 tween javafx.animation.Interpolator.DISCRETE,
                                    Panel_Menu.layoutX => 0.0 tween javafx.animation.Interpolator.DISCRETE,
                                ]
                                action: function() {
                                    Panel_Login.visible = true;
                                    vbox.nodeHPos = javafx.geometry.HPos.CENTER;
                                    Panel_Menu.visible = true;
                                }
                            }
                        ]
                    }
                } else {
                    null
                }
            }
        }
    }// </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="Generated Design Functions">
    public function getDesignRootNodes () : javafx.scene.Node[] {
        [ sfondo, Panel_Login, Panel_Menu, ]
    }
    
    public function getDesignScene (): javafx.scene.Scene {
        scene
    }// </editor-fold>//GEN-END:main

    function execLogin(): Void {
        //TODO
        var mylogin = new jfx_mobile_test_01.wsLoginSoap;

        mylogin.callWsLogin(txt_user.text, txt_passwd.text);
            
    }



}
